package com.alinesno.cloud.gateway.admin.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import com.alinesno.cloud.common.facade.orm.entity.BaseEntity;

/**
 * 基础网关服务实体
 * 
 * @author WeiXiaoJin
 * @since 2020年1月30日 下午19:45:08
 */
@MappedSuperclass
public class BaseGatewayEntity extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	// >>>>>>>>>>>>>>>>>> 接口安全策略_start >>>>>>>>>>>>>>>>>>>>>>>>
	@Column(name = "access_ip", length = 256)
	private String accessIp; // 允许的IP(以,作为分隔符)

	@Column(name = "deny_ip", length = 256)
	private String denyIp; // 限制IP(以,作为分隔符)

	@Column(name = "has_open", length = 1)
	private boolean hasOpen; // 是否打开

	@Column(name = "has_hystrix", length = 1)
	private boolean hasHystrix; // 是否打开(熔断信息)

	@Column(name = "hystrix_content", length = 256)
	private String hystrixContent; // 熔断器(用于错误的时候显示)

	@Column(name = "limit_request", length = 11)
	private Integer limitRequest = -1; // 限流(-1表示不限流)

	@Column(name = "has_encryption", length = 1)
	private boolean hasEncryption = false; // 是否加密(默认不加密)

	@Column(name = "enc_type", length = 128)
	private String encType; // 加密方式

	@Column(name = "decode_str", length = 128)
	private String decodeStr; // 解密代码

	@Column(name = "client_outtime", length = 11)
	private Integer clientOuttime = -1 ; // 客户端接口超时时间

	@Column(name = "server_outtime", length = 11)
	private Integer serverOuttime = -1 ; // 服务端超时时间

	@Column(name = "auth_type" , length = 64)
	private String authType; // 认证方式

	@Column(name = "open_time")
	private Date openTime; // 开始访问时间

	@Column(name = "close_time")
	private Date closeTime; // 禁止关闭时间

	@Column(name = "retrics", length = 11)
	private Integer retrics = 1; // 重试次数(默认为1次)

	@Column(name = "global_header", length = 128)
	private String globalHeader; // 全局头部(比如设置header)

	@Column(name = "request_count", length = 11)
	private Integer requestCount; // 访问次数
	
	@Column(name = "has_request_count", length = 11)
	private Integer hasRequestCount ; // 已访问次数
	
	@Column(name = "has_error_count", length = 11)
	private Integer hasErrorCount ; // 已访问失败次数
	// >>>>>>>>>>>>>>>>>> 接口安全策略_end >>>>>>>>>>>>>>>>>>>>>>>>

	// >>>>>>>>>>>> 路由_start >>>>>>>>>>>>
	@Column(name = "forward_url", length = 256)
	private String forwardUrl; // 转发目标

	@Column(name = "forward_type", length = 16)
	private String forwardType; // 转发类型(HTTP/SOCKET)

	@Column(name = "forward_ip", length = 32)
	private String forwardIp; // 转发IP

	@Column(name = "forward_port", length = 16)
	private Integer forwardPort; // 转发Port

	@Column(name = "business_server_id", length = 128)
	private String businessServerId; // 服务Id
	// >>>>>>>>>>>> 路由_end >>>>>>>>>>>>>

	public Integer getRequestCount() {
		return requestCount;
	}

	public Integer getHasErrorCount() {
		return hasErrorCount;
	}

	public void setHasErrorCount(Integer hasErrorCount) {
		this.hasErrorCount = hasErrorCount;
	}

	public Integer getHasRequestCount() {
		return hasRequestCount;
	}

	public void setHasRequestCount(Integer hasRequestCount) {
		this.hasRequestCount = hasRequestCount;
	}

	public String getForwardUrl() {
		return forwardUrl;
	}

	public void setForwardUrl(String forwardUrl) {
		this.forwardUrl = forwardUrl;
	}

	public String getForwardType() {
		return forwardType;
	}

	public void setForwardType(String forwardType) {
		this.forwardType = forwardType;
	}

	public String getForwardIp() {
		return forwardIp;
	}

	public void setForwardIp(String forwardIp) {
		this.forwardIp = forwardIp;
	}

	public Integer getForwardPort() {
		return forwardPort;
	}

	public void setForwardPort(Integer forwardPort) {
		this.forwardPort = forwardPort;
	}

	public String getBusinessServerId() {
		return businessServerId;
	}

	public void setBusinessServerId(String businessServerId) {
		this.businessServerId = businessServerId;
	}

	public String getAccessIp() {
		return accessIp;
	}

	public void setAccessIp(String accessIp) {
		this.accessIp = accessIp;
	}

	public String getDenyIp() {
		return denyIp;
	}

	public void setDenyIp(String denyIp) {
		this.denyIp = denyIp;
	}

	public void setRequestCount(Integer requestCount) {
		this.requestCount = requestCount;
	}

	public String getDecodeStr() {
		return decodeStr;
	}

	public void setDecodeStr(String decodeStr) {
		this.decodeStr = decodeStr;
	}

	public Date getOpenTime() {
		return openTime;
	}

	public void setOpenTime(Date openTime) {
		this.openTime = openTime;
	}

	public Date getCloseTime() {
		return closeTime;
	}

	public void setCloseTime(Date closeTime) {
		this.closeTime = closeTime;
	}

	public Integer getRetrics() {
		return retrics;
	}

	public void setRetrics(Integer retrics) {
		this.retrics = retrics;
	}

	public String getGlobalHeader() {
		return globalHeader;
	}

	public void setGlobalHeader(String globalHeader) {
		this.globalHeader = globalHeader;
	}

	public boolean isHasOpen() {
		return hasOpen;
	}

	public void setHasOpen(boolean hasOpen) {
		this.hasOpen = hasOpen;
	}

	public boolean isHasHystrix() {
		return hasHystrix;
	}

	public void setHasHystrix(boolean hasHystrix) {
		this.hasHystrix = hasHystrix;
	}

	public String getHystrixContent() {
		return hystrixContent;
	}

	public void setHystrixContent(String hystrixContent) {
		this.hystrixContent = hystrixContent;
	}

	public Integer getLimitRequest() {
		return limitRequest;
	}

	public void setLimitRequest(Integer limitRequest) {
		this.limitRequest = limitRequest;
	}

	public boolean isHasEncryption() {
		return hasEncryption;
	}

	public void setHasEncryption(boolean hasEncryption) {
		this.hasEncryption = hasEncryption;
	}

	public String getEncType() {
		return encType;
	}

	public void setEncType(String encType) {
		this.encType = encType;
	}

	public Integer getClientOuttime() {
		return clientOuttime;
	}

	public void setClientOuttime(Integer clientOuttime) {
		this.clientOuttime = clientOuttime;
	}

	public Integer getServerOuttime() {
		return serverOuttime;
	}

	public void setServerOuttime(Integer serverOuttime) {
		this.serverOuttime = serverOuttime;
	}

	public String getAuthType() {
		return authType;
	}

	public void setAuthType(String authType) {
		this.authType = authType;
	}

}
